
#ifndef _MODELRENDERERGAMECOMPONENT_H_
#define _MODELRENDERERGAMECOMPONENT_H_

#include "LibraryFrameworkExport.h"
#include "Game/GameTime.h"
#include "DrawableGameComponent.h"
#include "Maths/Matrix4.h"
#include "Graphics/Model/Model.h"
#include "Memory/ObjectPool.h"

#include <vector>
#include "Graphics/Effects/IEffect.h"

namespace CasaEngine
{
	class Game;

	/////////////////////////////////////////////////////////////
	/// CModelRendererGameComponent
	/////////////////////////////////////////////////////////////
	class LIBRARY_FRAMEWORK_EXPORT ModelRendererGameComponent :
		public DrawableGameComponent
	{
	private:
		class ModelRendererData : public ObjectPool<ModelRendererData>
		{
		public:
			Model *pModel;
			Matrix4 pMatWorld;
			IEffect *pEffect;
		};

	public:
		virtual void OnLoadContent();
		virtual void Draw();

		void AddModel(Model *pModel_, Matrix4 &pMatWorld_, IEffect *pEffect_);

		//EventHandler<int> DrawOrderChanged;

		ModelRendererGameComponent(Game* pGame_);
		virtual ~ModelRendererGameComponent();

		virtual void Update( const GameTime& gameTime_ );

	private:
		std::vector<ModelRendererData *> m_Datas;
	};

} // namespace CasaEngine

#endif // _MODELRENDERERGAMECOMPONENT_H_
